home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16448 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP ! => Problem compiling STL classes in Visual C++ 4.1.
  5. Date: 10 Apr 1996 22:03:02 GMT
  6. Organization: Borland International
  7. Message-ID: <4khb6m$o5e@druid.borland.com>
  8. References: <4kh12t$rs0@newsbf02.news.aol.com>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <4kh12t$rs0@newsbf02.news.aol.com>, haris1@aol.com says...
  15. >
  16. >I have problem compiling the following STL program
  17. >
  18. >namespace std
  19. >{
  20. >#include <Vector.h>
  21. >#include <Algo.h>
  22. >}
  23. >
  24. >
  25. >main ()
  26. >{
  27. >    std::vector <int> v;
  28. >
  29. >    v[0] = 1; v [1]=2; v[2]=3;
  30. >}
  31. >
  32. >I am getting an error.
  33. >"c:\msdev\stl\defalloc.h(124) : error C2660: 'new' : 
  34. >                        function does not take 2 parameters"
  35. >
  36. >I am using Visual C++ 4.1 under Window NT. I would appreciate if
  37. >anybody could tell me how to resolve this problem. Apparently it looks
  38. >like there is no overloaded 'new' operator defined in this STL files.
  39.  
  40. No, there isn't and there shouldn't be. Whoever advised you to add that 
  41. namespace declaration around the #include directives gave you truly bad advice. 
  42. You can't stick namespaces in from the outside. The headers must be written 
  43. with namespaces in mind. Whoever it was, put them on your list of people to 
  44. never ask for advice from. They don't know what they're talking about. Remove 
  45. the namespace declaration and forget about putting the standard library into a 
  46. namespace until it's supported natively.
  47.  
  48.